/**
 * Create by richliu1023
 * @date 16/5/19
 * @email richliu1023@gmail.com
 * @github https://github.com/RichLiu1023
 * @description a simple explanation
 */
module rm {

	export function getRes( name:string ):any {
		return RES.getRes( name );
	}

	export function getResImageTexture( name:string ):egret3d.ImageTexture {
		if ( !ResourceUtil.resDictionary[ name ] ) {
			ResourceUtil.resDictionary[ name ] = new egret3d.ImageTexture( RES.getRes( name ).bitmapData );
		}
		return ResourceUtil.resDictionary[ name ];
	}

	export function getResEam( name:string ):egret3d.SkeletonAnimationClip {
		if ( !ResourceUtil.resDictionary[ name ] ) {
			ResourceUtil.resDictionary[ name ] = egret3d.EAMParser.parse( RES.getRes( name ) );
		}
		return ResourceUtil.resDictionary[ name ].clone();
	}

	export function getResEsm( name:string ):egret3d.Geometry {
		if ( !ResourceUtil.resDictionary[ name ] ) {
			ResourceUtil.resDictionary[ name ] = egret3d.ESMParser.parse( RES.getRes( name ) );
		}
		return ResourceUtil.resDictionary[ name ];
	}

	export function getResEca( name:string ):egret3d.CameraAnimationController {
		if ( !ResourceUtil.resDictionary[ name ] ) {
			ResourceUtil.resDictionary[ name ] = egret3d.ECAParser.parse( RES.getRes( name ) );
		}
		return ResourceUtil.resDictionary[ name ];
	}

	class ResourceUtil {
		public static resDictionary:any = {};
	}
}